> How can you set an environment variable in a dos window from an icon
program ?
I'm not sure that you can. Some time back, I recall hearing that Windows was changed to crunch out unused space in the environment area when opening DOS windows (as a way to reduce memory usage... not that that's QUITE so important anymore).
I'm curious what you intend to accomplish by setting the environment variables, though. If you open a DOS window from an Icon program, and if you COULD set the environment variable within that DOS window, you ought to understand that that environment variable would disappear anyhow when the DOS window closes (i.e. upon return to Icon) since environment variables do NOT propagate back to higher DOS windows. You don't therefore change the environment variables that the Icon program would see, for instance.
If you CAN set them at all (subject to the space available, which MIGHT be zero) for use in later programs running under that SAME DOS shell) you would probably need to do that using a batch file which includes a SET statement prior to the command that runs the target program.
The workaround for the "collapsed environment area" that was usually discussed back when this "feature" of Windows came out was to create in the AUTOEXEC.BAT file one or more dummy "placeholder" environment variables which could be undefined (or defined to a null string, or at least something shorter, thus releasing the space) within your Icon program's invoked DOS shell prior to adding the new environment variable.
Gordon Peterson
http://web2.airmail.net/gep2/
Support the Anti-SPAM Amendment! Join at http://www.cauce.org/
12/19/98: the day the Conservatives demonstrated their scorn for their
fraudulent sham of representative government. Voters, remember it!